CSS [attr^=value] Selector
What is CSS [att^=value] Selector?
CSS [att^=value] selector matches all elements whose attribute value beginning with value string.
Syntax
This is general syntax,
[attr^=value] {
property: value;
property: value;
...
}
Example
Select every element whose attribute class value beginning with dem string to apply CSS style.
<!DOCTYPE html>
<html>
<head>
<title>CSS [attr^=value] Selector</title>
<style type="text/css">
a[class^=dem] {
background: yellow;
}
</style>
</head>
<body>
<a class="demo" href="#">English International</a><br />
<a class="de" href="#">English US</a><br />
<a class="demos" href="#">Google</a><br />
</body>
</html>
Browser Compatibility
- Google Chrome 2+
- Mozilla Firefox 3+
- Internet Explorer 9+
- Opera 9.5+
- Safari 1.3+
Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.